import 'dart:async';

import 'package:event_bus/event_bus.dart';

class EventBusManager {
  EventBus _eventBus;
  static final EventBusManager _instance = EventBusManager._internal();

  EventBusManager._internal() {
    _eventBus = EventBus();
  }

  factory EventBusManager.getInstance() => _instance;

  void postEvents<T>(T event) => _eventBus.fire(event);

  StreamSubscription listen<T>(Function(T) callback) =>
      _eventBus.on<T>().listen(callback);
}
